package cn.yx.common.mybatis.test.service.impl;

import cn.yx.common.mybatis.service.AbstractMybatisPlusService;
import cn.yx.common.mybatis.test.cond.UserAccountCond;
import cn.yx.common.mybatis.test.dos.UserAccountDo;
import cn.yx.common.mybatis.test.dto.UserAccountDto;
import cn.yx.common.mybatis.test.mapper.UserAccountPlusMapper;
import cn.yx.common.mybatis.test.mapping.UserAccountMapping;
import cn.yx.common.mybatis.test.service.UserAccountService;
import org.springframework.stereotype.Service;

/**
 * <p>用户账户服务实现类</p>
 *
 * @author Wgssmart
 */
@Service("UserAccountPlusServiceImpl")
public class UserAccountPlusServiceImpl
        extends AbstractMybatisPlusService<UserAccountDo,
        UserAccountDto,
        UserAccountCond,
        Long,
        UserAccountPlusMapper>
        implements UserAccountService {

    private final UserAccountPlusMapper userAccountPlusMapper;

    public UserAccountPlusServiceImpl(UserAccountPlusMapper userAccountPlusMapper) {
        super(userAccountPlusMapper, UserAccountMapping.INSTANCE);
        this.userAccountPlusMapper = userAccountPlusMapper;
    }

    @Override
    public UserAccountDto saveReturnId(UserAccountDto userAccountDto) {
        UserAccountDo userAccountDo = UserAccountMapping.INSTANCE.dtoToDo(userAccountDto);
        userAccountPlusMapper.insert(userAccountDo);
        userAccountDto.setId(userAccountDo.getId());
        return userAccountDto;
    }

}
